import sys
from PyQt5.QtWidgets import *
from PyQt5.QtGui import *
from PyQt5.QtCore import *

class DialogDemo(QMainWindow):
    def __init__(self,parent=None):
        super(DialogDemo,self).__init__(parent)
        self.setWindowTitle("Dialog")
        self.resize(400,400)
        self.btn=QPushButton(self)
        self.btn.setText("弹出对话框")
        self.btn.clicked.connect(self.msg)

    def msg(self):
        #reply=QMessageBox.information(self,"标题","消息的正文",QMessageBox.Yes|QMessageBox.No,QMessageBox.Yes)
        reply=QMessageBox.question(self, '标题', '提问框消息正文', QMessageBox.Yes | QMessageBox.No, QMessageBox.Yes)
        print(reply)
if __name__ == '__main__':
    app=QApplication(sys.argv)
    demo=DialogDemo()
    demo.show()
    sys.exit(app.exec_())